//初始化统计图的展示形式及数据,生成图和表
function createTableAndChart(action) {
	var showPercent = false;
	initLeftMemu();
	var data = getUrlData();
	var msg = getData(data, action);
	var seriesData = ""; //按series的格式{name:name,data:data}接收数据，最终转成json格式
	var seriesName = "";
	var seriesDataForStatYear = "";
	var xAxisCategoriesForStatYear = "";
	var valid = msg.valid;
	var xTitle = "Time(M)";
	for ( var i = 0; i < valid.length; i++) {
		if (i == 0) {
			xTitle = "Time(Y)";
		}
		for ( var n = 0; n < valid[i].data.length; n++) {
			seriesDataForStatYear += valid[i].data[n].data + ",";
		}
		xAxisCategoriesForStatYear += valid[i].year + ",";
	}

	if (seriesDataForStatYear != "") {
		seriesDataForStatYear = seriesDataForStatYear.substr(0, seriesDataForStatYear.length - 1);
		var dataArray = seriesDataForStatYear.split(",");
		var series1 = "";
		var series2 = "";
		for ( var i = 0; i < dataArray.length / 2; i++) {
			series1 += dataArray[2 * i] + ",";
			series2 += dataArray[2 * i + 1] + ",";
		}
		seriesData += "{name:'" + (valid[0].data[0].type.length == 1 ? valid[0].data[0].type + valid[0].tx : valid[0].data[0].type) + "',data:["
				+ series1.substr(0, series1.length - 1) + "]}," + "{name:'" + (valid[0].data[1].type.length == 1 ? valid[0].data[1].type + valid[0].tx : valid[0].data[1].type)
				+ "',data:[" + series2.substr(0, series2.length - 1) + "]},";
		xAxisCategories = "[" + xAxisCategoriesForStatYear.substring(0, xAxisCategoriesForStatYear.length - 1) + "]";
	}
	seriesData = seriesData.substr(0, seriesData.length - 1);
	createTheme();
	var options = createOptionsSeriesType('container',data.type);
	options.xAxis.categories = eval("(" + xAxisCategories + ")");//将读取到的数据转成json数组格式
	options.series = eval("[" + seriesData + "]");//将图例数据部分转成json数组格式
	options.xAxis.title.text = xTitle;
	options.yAxis.title.text = valid[0].tx+" No.";
	options.title.text = valid[0].year + "-" + valid[valid.length - 1].year + " " + replaceWithChar(data.title, "_", " "); //" Number Stat. By Month";

	createAnnualContrastTable(options.xAxis.categories, options.series, showPercent,valid,'dataAnnualContrastDiv');
	createInValidTable(msg.invalid,'invalidTableDiv');
	createChart(options);
}
createTableAndChart('getChart2_2_0_1');